package com.liang.service.impl;

import java.util.List;
import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.liang.dao.PageDao;
import com.liang.pojo.Data;
import com.liang.pojo.Page;
import com.liang.pojo.User;
import com.liang.service.PageService;
public class PageServiceImpl implements PageService{
	@Autowired
	PageDao pageDao;
	public void setPageDao(PageDao pageDao) {
		this.pageDao=pageDao;
	}

	/*
	 * @Override public Page getPage(int currentPage, int pageSize) { Page page=new
	 * Page(currentPage,pageSize); int startIndex = page.getStartIndex();
	 * 
	 * List<User> pageList = pageDao.selectPageList(startIndex, pageSize);
	 * page.setLists(pageList);
	 * 
	 * int pageCount = pageDao.selectPageCount(); page.setTotal(pageCount);//设置总记录数
	 * return page; }
	 */
	
	
	/*
	 * public Page getPage2(Map<String,Object> map) { Page page=new
	 * Page((int)map.get("currentPage"),(int)map.get("pageSize")); int startIndex =
	 * page.getStartIndex(); map.put("startIndex", startIndex); List<User> pageList2
	 * = pageDao.selectPageList2(map); page.setLists(pageList2);
	 * 
	 * int pageCount2 = pageDao.selectPageCount2(map);
	 * page.setTotal(pageCount2);//设置总记录数 return page; }
	 */

	public int insertUser(User user) {
		
		return pageDao.insertUser(user);
	}

	public int deleteBeach(Page page) {
		pageDao.deleteBeach(page);
		return 0;
	}

	public List<User> selectAllUser() {
		return pageDao.selectAllUser();
	}

	
	public List<User> selectAllUser2(Map<String, Object> map) {
		// TODO Auto-generated method stub
		return pageDao.selectAllUser2(map);
	}

	public int updateUser(Map<String, Object> map) {
		// TODO Auto-generated method stub
		return pageDao.updateUser(map);
	}

	public User selectUserById(int id) {
		// TODO Auto-generated method stub
		return pageDao.selectUserById(id);
	}

	public int deleteUserById(int id) {
		// TODO Auto-generated method stub
		return pageDao.deleteUserById(id);
	}

	public int deleteUserByList(Data data) {
		// TODO Auto-generated method stub
		return pageDao.deleteUserByList(data);
	}

	public Page getPage2(Map<String, Object> map) {
		// TODO Auto-generated method stub
		return null;
	}

}
